// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
import './mock'

import bootstrap from './core/bootstrap.js'
import './core/lazy_use'
import './permission' // permission control
import './utils/filter' // global filter
import './components/global.less'
import { Dialog } from '@/components'
import { hasBtnPermission } from './utils/permissions' // button permission
import { sysApplication } from './utils/applocation'
// language
import formCreate from '@form-create/ant-design-vue'
import KFormDesign from 'k-form-design'
// import KFormDesign from 'k-form-design/lib/k-form-design-mini.umd.min'
import 'k-form-design/lib/k-form-design.css'
import 'ant-design-vue/dist/antd.css'

import VueCodemirror from 'vue-codemirror'
// // language
import 'codemirror/mode/javascript/javascript.js'

import 'babel-polyfill'

// // theme css
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/monokai.css'

import './assets/iconfont.css'
import './style/material.css'

import { ColorPicker } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import ElementUI from 'element-ui'
import dataV from '@jiaminghi/data-view'

Vue.use(KFormDesign)
Vue.use(dataV)
Vue.use(ColorPicker)
Vue.use(formCreate)
Vue.use(VueCodemirror)
Vue.use(VueAxios)
Vue.use(Dialog)
Vue.use(ElementUI)
Vue.prototype.hasPerm = hasBtnPermission
Vue.prototype.applocation = sysApplication

Vue.config.productionTip = false

async function init() {
  /* append all 3rd party libraries make sure graph template works fine */
  /* eslint-disable no-new */
  new Vue({
    el: '#app',
    router,
    store,
    data: function() {
      return {
        diagramInstance: null,
        graphicsDesignerJson: '',
        diagramNodes: [],
        selectedNode: {}
      }
    },
    components: { App },
    template: '<App/>',
    created: bootstrap,
    render: h => h(App)
  })
}
init()
